﻿<phone:PhoneApplicationPage 
    x:Class="MobiSms.Wasun.Views.ReplyDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodel="clr-namespace:MobiSms.ViewModel;assembly=MobiSms.ViewModel"
    xmlns:UX="clr-namespace:MobiSms.UX;assembly=MobiSms.UX"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="{Binding GlobalSettings.BackgroundImage}" Stretch="{Binding GlobalSettings.BackgroundImageStretch}" />
        </Grid.Background>
        <Grid.DataContext>
            <viewmodel:ReplyDetailsViewModel/>
        </Grid.DataContext>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{StaticResource IDS_APP_NAME}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{StaticResource IDS_REPLY_DETAILS_TITLE}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid Visibility="{Binding DetailPanelVisibility}">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <ScrollViewer>
                    <StackPanel>
                        <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_REPLY_MOBILE}"/>
                        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" Text="{Binding CurrentReply.Mobile}"/>
                        <TextBlock Style="{StaticResource PhoneTextNormalStyle}" Text=" "/>
                        <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_REPLY_SERIAL}"/>
                        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" Text="{Binding CurrentReply.Serial}"/>
                        <TextBlock Style="{StaticResource PhoneTextNormalStyle}" Text=" "/>
                        <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_REPLY_TIME}"/>
                        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" Text="{Binding CurrentReply.Time}"/>
                        <TextBlock Style="{StaticResource PhoneTextNormalStyle}" Text=" "/>
                        <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_REPLY_CONTENT}"/>
                        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" Text="{Binding CurrentReply.Content}" TextWrapping="Wrap"/>
                    </StackPanel>
                </ScrollViewer>
                <StackPanel Orientation="Horizontal" 
                            Grid.Row="1" 
                            Margin="12" 
                            HorizontalAlignment="Right">
                    <UX:UXPathButton IconPath="{StaticResource PATH_ICON_MAIN_SEND}" 
                                     Command="{Binding OpenReplyPanelCommand}" 
                                     Padding="10" 
                                     Margin="24,0"/>
                    <UX:UXPathButton IconPath="{StaticResource PATH_ICON_DELETE}" 
                                     Command="{Binding DeleteCommand}"/>
                </StackPanel>
            </Grid>
            <Grid Visibility="{Binding ReplyPanelVisibility}">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <ScrollViewer>
                    <StackPanel>
                        <toolkit:ListPicker Header="{StaticResource IDS_MESSAGE_SERIAL}" 
                                                ItemsSource="{Binding ItemsOfSerial}" 
                                                SelectedItem="{Binding SelectedSerial, Mode=TwoWay}">
                            <toolkit:ListPicker.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding SerialNumber}"/>
                                </DataTemplate>
                            </toolkit:ListPicker.ItemTemplate>
                            <toolkit:ListPicker.FullModeItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding SerialNumber}" Style="{StaticResource PhoneTextTitle2Style}" Margin="0,0,0,12"/>
                                </DataTemplate>
                            </toolkit:ListPicker.FullModeItemTemplate>
                        </toolkit:ListPicker>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                                           Text="{StaticResource IDS_MESSAGE_CONTENT}"/>
                            <TextBlock Style="{StaticResource PhoneTextNormalStyle}" 
                                           Text="{Binding NewMessageToSend.Content.Length}" 
                                           Grid.Column="1"/>
                        </Grid>
                        <TextBox Text="{Binding Mode=TwoWay, Path=NewMessageToSend.Content, UpdateSourceTrigger=Explicit}" 
                                     TextChanged="OnTextBoxTextChanged"
                                     AcceptsReturn="True" 
                                     TextWrapping="Wrap"/>
                        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                                       Text="{StaticResource IDS_MESSAGE_EXTENSION}"/>
                        <TextBox InputScope="Number" 
                                     Text="{Binding NewMessageToSend.Extension, Mode=TwoWay}"/>
                        <CheckBox Content="{StaticResource IDS_MESSAGE_USESIGNATURE}" 
                                      IsChecked="{Binding NewMessageToSend.IsSign, Mode=TwoWay}"/>
                        <TextBox Text="{Binding NewMessageToSend.Signature, Mode=TwoWay}" 
                                     Visibility="{Binding NewMessageToSend.IsSign, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                        <TextBlock Style="{StaticResource PhoneTextTitle2Style}" 
                                       Text="{StaticResource IDS_MESSAGE_CHARGECOUNT}"/>
                        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                                       Text="{Binding TotleSendCount}" />
                    </StackPanel>
                </ScrollViewer>
                <StackPanel Orientation="Horizontal" 
                            Grid.Row="1" 
                            Margin="12" 
                            HorizontalAlignment="Right">
                    <UX:UXPathButton IconPath="{StaticResource PATH_ICON_SUBMIT}" Command="{Binding SendCommand}" Margin="24,0"/>
                    <UX:UXPathButton IconPath="{StaticResource PATH_ICON_CLOSE}" Command="{Binding CancelCommand}" Padding="14"/>
                </StackPanel>
            </Grid>
            
        </Grid>
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>
